package com.zhengze;

public class Demo9 {
    public static void main(String[] args) {
        // 以,作为分隔符
        String[] splits = "a,b,c".split(",");
        for (String split : splits) {
            System.out.println(split);
        }

        // 指定分隔符的范围，并且至少有一个分隔符
        System.out.println("----------");
        String[] splits2 = "a,b ;; c".split("[,;\\s]+");
        for (String s : splits2) {
            System.out.println(s);
        }
    }
}

/*
    a
    b
    c
    ----------
    a
    b
    c
 */